#ifndef SPEEDBOARD_H
#define SPEEDBOARD_H

#include <QtCore/QObject>
#include <QWidget>
#include <QPainter>
#include <QLabel>

#ifdef Q_OS_LINUX
//图片中心点
#define CenterPoint_X 115
#define CenterPoint_Y 115

//指针中心点
#define Neddle_Center_X 54
#define Neddle_Center_Y 2

//指针尺寸
#define Neddle_W 108
#define Neddle_H 9

//旋转角度
#define Neddle_MinAngle 0
#define Neddle_MaxAngle 225

 //转动步长
#define speedStep 1
#define Speed_Max 120
#endif

class SpeedBoard : public QWidget
{
  Q_OBJECT

public:
#ifdef Q_OS_WIN32
  //图片中心点
  const quint16 CenterPoint_X = 115;
  const quint16 CenterPoint_Y = 115;

  //指针中心点
  const quint16 Neddle_Center_X = 54;
  const quint16 Neddle_Center_Y = 2;

  //指针尺寸
  const quint16 Neddle_W = 108;
  const quint16 Neddle_H = 9;

  //旋转角度
  const qint16 Neddle_MinAngle = 0;
  const qint16 Neddle_MaxAngle = 225;

  //转动步长
  const quint16 speedStep = 1;

  const quint16 Speed_Max = 120;
#endif

public:
#ifdef Q_OS_WIN32
  explicit SpeedBoard(QWidget *parent = nullptr);
#elif defined(Q_OS_LINUX)
  explicit SpeedBoard(QWidget *parent = 0);
#endif
  void paintEvent(QPaintEvent *);

  void setSpeedValue(const qint16 &value);
signals:

public slots:

private:
  qint16 speedValue;
  qint16 neddleAngle;

  QLabel *speedH_label;
  QLabel *speedM_label;
  QLabel *speedL_label;
};

#endif // SPEEDBOARD_H
